#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>

void delay_handler(int sig)
{
    int i = 0;
    printf("begin delay handler...\n");
    for(i = 0; i < 5; i++) {
        printf("sig(%d) - sleep %d ...\n", sig, i);
        sleep(1);
    }
    printf("end delay handler...\n");
}

int main(void)
{
    char buf[32] = {0};
    
    signal(SIGINT, delay_handler);
    
    while (1) {
        pause();
    }

    return 0;
}

